package net.yla.smartbus.module.ba.vehicletype.detachment;

import net.yla.smartbus.core.enums.FuelTypeEnum;
import net.yla.smartbus.core.enums.RankEnum;
import net.yla.smartbus.module.ba.vehicletype.dto.VehicleTypeDto;
import net.yla.smartbus.module.ba.vehicletype.entity.BaVehicleModelsDo;

/**
 * @author 默苍离
 * @date 2021/6/28 10:42
 * <p>
 * ******************************************
 * @annotation: 抽离的方法
 */
public class VehicleTypeDetachment {

    /**
     * 车辆类型do转dto
     *
     * @param vehicleType
     * @return
     */
    public static VehicleTypeDto vehicleTypeDoToTto(BaVehicleModelsDo vehicleType) {

        VehicleTypeDto vehicleTypeDto = new VehicleTypeDto();

        if (vehicleType.getModelId() != null) {
            vehicleTypeDto.setId(vehicleType.getModelId());
        }
        vehicleTypeDto.setName(vehicleType.getName());
        vehicleTypeDto.setBrandName(vehicleType.getBrandName());

        if (vehicleType.getBrandId() != 0) {
            vehicleTypeDto.setBrandId(vehicleType.getBrandId());
        }
        vehicleTypeDto.setPrice(vehicleType.getPrice());
        if (vehicleType.getFuelType() != 0) {
            vehicleTypeDto.setFuelType(vehicleType.getFuelType());
        }
        String name = FuelTypeEnum.getName(vehicleType.getFuelType());
        vehicleTypeDto.setFuelTypeName(name);
        if (vehicleType.getRank() != 0) {
            vehicleTypeDto.setRank(vehicleType.getRank());
        }
        String rankName = RankEnum.getName(vehicleType.getRank());
        vehicleTypeDto.setRankName(rankName);

        vehicleTypeDto.setWeightType(vehicleType.getWeightType());
        vehicleTypeDto.setDischarge(vehicleType.getDischarge());
        vehicleTypeDto.setDrivingLicense(vehicleType.getDrivingLicense());
        vehicleTypeDto.setStage(vehicleType.getStage());
        vehicleTypeDto.setArrange(vehicleType.getArrange());
        vehicleTypeDto.setCylinders(vehicleType.getCylinders());
        vehicleTypeDto.setTurbo(vehicleType.getTurbo());
        vehicleTypeDto.setDisplacement(vehicleType.getDisplacement());
        vehicleTypeDto.setConsumption(vehicleType.getConsumption());
        vehicleTypeDto.setAcceleration(vehicleType.getAcceleration());
        vehicleTypeDto.setCompression(vehicleType.getCompression());
        vehicleTypeDto.setRoz(vehicleType.getRoz());
        vehicleTypeDto.setAxleCount(vehicleType.getAxleCount());
        vehicleTypeDto.setAxleLoad(vehicleType.getAxleLoad());
        vehicleTypeDto.setCapacity(vehicleType.getCapacity());
        vehicleTypeDto.setCurbWeight(vehicleType.getCurbWeight());
        vehicleTypeDto.setRatedWeight(vehicleType.getRatedWeight());

        vehicleTypeDto.setSeatCount(vehicleType.getSeatCount());

        return vehicleTypeDto;
    }


}
